<template>
	<view class="wrap">
		<u-tabs :list="list1" @click="click" lineWidth="30" lineColor="#f56c6c" :activeStyle="{
            color: '#303133',
            fontWeight: 'bold',
            transform: 'scale(1.05)'
        }" :inactiveStyle="{
            color: '#606266',
            transform: 'scale(1)'
        }" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"></u-tabs>
		<view @click="goeditor" class="editor iconfont icon-edit-filling"></view>
		<item :msg="newsfrom"></item>
	</view>
</template>

<script setup>
	const db = uniCloud.database()
	import { ref, reactive } from 'vue'
	import { useStore } from '../../stores/store.js'
	import { onLoad } from '@dcloudio/uni-app'
	const loading = ref(true)
	const store = useStore()
	const newsfrom = ref()
	const click = (e) => {
		console.log(e);
	}
	const list1 = [{

		name: '关注',
	}, {
		name: '推荐',
	}, {
		name: '电影'
	}, {
		name: '科技'
	}, {
		name: '音乐'
	}, {
		name: '美食'
	}, {
		name: '文化'
	}, {
		name: '财经'
	}, {
		name: '手工'
	}]
	onLoad(() => {


		const newtemp = db.collection('articles').getTemp()
		const usertemp = db.collection('uni-id-users').field('_id,username,nickname,avatar_file.url as ava')
			.getTemp()
		db.collection(newtemp, usertemp).orderBy('publish_date desc').get().then(res => {
			console.log(res);
			newsfrom.value = res.result.data
		})
	})

	const goeditor = () => {
		// console.log('1111111');
		uni.navigateTo({
			url: "/pages/editor/editor"
		})
	}
</script>

<style lang="scss" scoped>
	.wrap {
		// margin-bottom: 30px;
	}

	.editor {
		display: block;
		width: 50px;
		height: 50px;
		font-size: 30px;
		text-align: center;
		line-height: 50px;
		background-color: skyblue;
		border-radius: 50%;
		position: fixed;
		bottom: 70px;
		right: 30px;
		z-index: 100;
	}
</style>